﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;

namespace CloudReader.Command
{
    public class DelegateCommad : ICommand
    {
        public event EventHandler CanExecuteChanged;

        public bool CanExecute(object parameter)
        {
            if (CanExecuteFunc != null)
            {
                return CanExecuteFunc(parameter);
            }
            else
            {
                return true;
            }
        }

        public void Execute(object parameter)
        {
            ExecuteFunc?.Invoke(parameter);
        }
        public Func<object,bool> CanExecuteFunc { get; set; }
        public Action<object> ExecuteFunc { get; set; }
    }
}
